home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / macros / tip / arbday.tip < prev    next >
Text File  |  1993-09-15  |  2KB  |  55 lines

  1. % This macro source file is from the four volume series
  2. % "TeX in Practice" by Stephan von Bechtolsheim, published
  3. % 1993 by Springer-Verlag, New York.
  4. % Copyright 1993 Stephan von Bechtolsheim.
  5. % No warranty or liability is assumed.
  6. % This macro may be copied freely if no fees other than
  7. % media cost or shipping charges are charged and as long
  8. % as this copyright and the following source code itself
  9. % is not changed. Please see the series for further information.
  10. %
  11. % Version: 1.0
  12. % Date: May 1, 1993
  13. %
  14. %
  15. % This source code is documented in 26.16, p. III-381.
  16. % Original source in file "macros6.TEX", starting line 1098.
  17. \wlog{L: "arbday.tip" ["macros6.TEX," l. 1098, p. III-381]}%
  18. % This file DOES belong to format "texip."
  19. \InputD{legdate.tip}
  20. \InputD{dateofw.tip}
  21. \InputD{imodn.tip}
  22. \InputD{nextday.tip}
  23. \InputD{numdyr.tip}
  24. \InputD{prmonth.tip}
  25. \InputD{earliest.tip}
  26. \InputD{doloop.tip}
  27. \catcode`\@ = 11
  28. \newcount\@YearTemp
  29. \newcount\@YearTop
  30. \newcount\@MonthTemp
  31. \newcount\@MonthTop
  32. \newcount\@TempAD
  33. \def\ArbitraryDayOfWeek #1#2#3#4{%
  34.     \CheckDate{#1}{#2}{#3}%
  35.     #4 = \DayOfWeekOfEarliestDate
  36.     \@YearTop = #1\relax
  37.     \advance\@YearTop by -1
  38.     \DoLoop{\@YearTemp}{\EarliestYearDate}{1}{\@YearTop}{%
  39.         \NumberOfDaysInYear{\@YearTemp}{\@TempAD}%
  40.         \advance #4 by \@TempAD
  41.     }%
  42.     \IModN{#4}{7}{#4}%
  43.     \@MonthTop = #2\relax
  44.     \advance\@MonthTop by -1
  45.     \DoLoop{\@MonthTemp}{1}{1}{\@MonthTop}{%
  46.         \NumberOfDaysInMonth{#1}{\@MonthTemp}{\@TempAD}%
  47.         \advance #4 by \@TempAD
  48.     }%
  49.     \IModN{#4}{7}{#4}%
  50.     \advance #4 by #3\relax
  51.     \advance #4 by -1
  52.     \IModN{#4}{7}{#4}%
  53. }
  54. \catcode`\@ = 12
  55.